
public class TestCounter {
	
	private final Counter c = new Counter();
	
	public	TestCounter(){
		//System.out.println("TESTCOUNTER - Construtor do Testcounter");
	}
	
	public void something() throws InterruptedException{
		long start = System.nanoTime();
		
		Thread[] ts = new Thread[10];
		
		for (int i = 0; i < ts.length; i++) {
			ts[i] = new Thread() {
				@Override
				public void run() {
					for (int i = 0; i < 1000; i++) { //1000*1000
						TestCounter.this.c.inc();
						//Fib.seqFib(3);
					}
				}
			};
			
			ts[i].start();
		}
		
		for (Thread t : ts) {
			t.join();
		}
		
		long time = System.nanoTime() - start;
		System.out.printf("Counting %d took %f ms\n", this.c.getCount(), time/1e6);
		System.out.printf("Counting %d took %f ms\n", Counter.coisaEstatica, time/1e6);
		
	}
	
	
	
	public static void main(String[] args) throws Exception {
		new TestCounter().something();
	}
}
